<?php
include('../../inc/global.inc');
include("../islogin.php");
$url="template.php";
$thepage=$_GET['page']?$_GET['page']:1;
$maxpage=20;

if($_GET['del_act']){
mysql_query("delete from template where id='".$_GET['del_id']."'");
echo "<script>location='template.php';</script>";
}
?>
<HTML>
<HEAD>
<TITLE>Admin</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<LINK href="../css/css.css" rel=stylesheet>
<script type='text/javascript' src="../js/islogin.js" charset="gb2312"></script>
</HEAD>
<BODY>
<center>
  <table width="70%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td height="25" bgcolor="#EEEEF9" style="padding-left:5px;">模板列表 &nbsp;&nbsp;<a href="javascript:history.go(-1)">返回</a></td>
    </tr>
  </table>
  <table width="70%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td width="9%" height="30" align="center" bgcolor="#8DA8CF">编号</td>
      <td width="31%" align="center" bgcolor="#8DA8CF">模板名称</td>
      <td width="15%" align="center" bgcolor="#8DA8CF">模板分类</td>
      <td width="8%" align="center" bgcolor="#8DA8CF">编号</td>
      <td width="22%" align="center" bgcolor="#8DA8CF">图片</td>
      <td width="15%" align="center" bgcolor="#8DA8CF"><a href="template_modify.php?tj=ok&id=<?=$_GET[id]?>">添加模板</a></td>
    </tr>
<?php
$sql="select * from template order by id asc";
$rs=mysql_query($sql);
$i=1;
while($row=mysql_fetch_array($rs)){
$color=($i%2)?"#FFFFFF":"#eeeeee";
?>
    <tr bgcolor=<?=$color?>>
      <td height="25" align="center"><?=$i?></td>
	  <td align="left" style="padding-left:10px;"><?=$row[t_name]?></td>
      <td align="center" style="padding-left:10px;"><?php if($row[t_type]==3){echo "普通会员";}elseif($row[t_type]==6){echo "钻石会员";}?></td>
      <td align="center" style="padding-left:10px;"><?=$row[t_id]?></td>
      <td align="center" style="padding-left:10px;"><img src="http://www.sandib2b.cn/img/<?=$row[picture]?>" width="100" height="100" border="0"></td>
      <td align="center"><a href="template_modify.php?xg=ok&xg_id=<?=$row['id']?>">编辑</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="<?=$url?>?del_act=ok&del_id=<?=$row['id']?>" onClick="return del()">删除</a></td>
    </tr>
<?php
$i++;}//分页参数
$totalrecord=mysql_num_rows(mysql_query("select * from template "));
$totalpage=ceil($totalrecord/$maxpage);
?>
<tr><form method="get" action="<?=$url?>">
   <td height="25" colspan="6" align="center" bgcolor="#FFFFFF">
<?php if($thepage>1){?>
   <a href="<?=$url?>">第一页</a>&nbsp;<a href="<?=$url?>?page=<?=$thepage-1?>">上一页</a>&nbsp;
<?php }?>  
<?php if($thepage!=$totalpage&&$totalpage>0){?>
   <a href="<?=$url?>?page=<?=$thepage+1?>">下一页</a>&nbsp;<a href="<?=$url?>?page=<?=$totalpage?>">最后一页</a>&nbsp;
<?php }?>   
   【共<font color="red"><?=$totalrecord?></font>条记录】【每页<font color="red"><?=$maxpage?></font>条记录】【共<font color="red"><?=$totalpage?></font>页】<input type="text" name="page" size="3" onKeyUp="IsDigit(this);">&nbsp;<input type="submit" value="GO"></td></form>
</tr>
  </table>
</center>
</BODY>
</HTML>
